<template>
    <p>这是一个Home页</p>
    <p>js跳转</p>
    <button @click="pushStr">字符串-跳转</button>
    <button @click="pushPath">Path-跳转</button>
    <button @click="pushNameParams">push-命名路由-参数跳转</button>
    <button @click="pushNameQuery">push-命名路由-query参数跳转</button>
    

</template>
<script>
export default {
    methods:{
        pushStr(){
            this.$router.push("/about")
        },
        pushPath(){
            this.$router.push({path:"/about"})
        },
        pushNameParams(){
            this.$router.push({name:'about',state:{params:{id:2}}})
        },
        pushNameQuery(){
            this.$router.push({path:"/about",query:{id:2,name:'tom'}})
        },
        pushDynRouteByName(){
        this.$route.push({name:'product',params:{id:123}})
        },
        pushDynRouteByPath(){
            const id =123
            this.$route.push({path:'/product'+'/'+id})
        }
    },
    mounted(){
        console.log('this.$route',this.$route);
        console.log('this.$router',this.$router);

    }
}
</script>